import os
import pygame

from objects.traits.traits import Size
from settings import IMAGE_SETTINGS
from tiles.tile import Tile


class Object(Tile):
    imagePath = ''
    def __init__(self, image = '', size = Size.NORMAL, location = None, layer = None, timeCreated = None, **kwargs):
        super(Object,self).__init__()
        self.image = image
        self.size = size
        self.layer = layer
        self.timeCreated = timeCreated
    
    def onDestruction(self):
        pass
    
    def showTile(self):
        srf = super(Object, self).showTile()
        img = pygame.image.load(self.__getImagePath())
        img = img.convert_alpha()
        srf.blit(img, (0,0))
        return srf
              
    def __getImagePath(self):
        path = IMAGE_SETTINGS.BASE_IMAGE_PATH + os.sep
        if self.imagePath:
            path += self.imagePath + os.sep
        path += self.image
        return path
